<?php 
	$html->css("add", null, array("inline"=>false));
	$html->css("jquery-ui", null, array("inline"=>false));
	$html->script("tiny_mce/tiny_mce",false); 
	$html->script("add",false); 
	$html->script("jquery-ui",false); 
?>
<div id="postOuter">
	<?php echo $form->create('Post',array('action'=>'update'));?>
	<div id="left">
		<h2> Update Post</h2>
		<fieldset>
			<legend>Update Post</legend>
			<?php
				echo $form->input('Title',array('label'=>'Title(optional)','value'=>$post['title']));
				echo $form->input('postID',array('value'=>$post['id'],'type'=>'hidden'));
				echo $form->input('content',array('value'=>$post['content']));
				echo $form->submit('Creat Post');		
			?>
		</div>
		<div id="sideBar">
			<?php				
				echo $form->input('Publish', array('options' => array(
												'published'=>'Published',
												'draft'=>'Draft'
												)));
				echo $form->input('post_time',array('class'=>'date','type'=>'text','value'=>$post['post_time']));
				$tagStr = '';
				$i = 0;
				foreach($tags as $tag){
					if($i != 0){
						$tagStr .= ','.$tag['Tag']['name'];						
					}else{
						$tagStr .= $tag['Tag']['name'];
						$i++;
					}
				}
				echo $form->input('tags',array('value'=>$tagStr,'type'=>'text'));
			?>
			<div id="tagsShow">
				<span>
					<?php
						foreach($tags as $tag){
							echo '<div class="token"><span>'.$tag['Tag']['name'].'</span><a href="#" title="Remove tag">x</a></div>';
						} 
					?>
				</span>
				<input id="inputEditor" type="text">
			</div>	
			<?php
				echo $form->input('source_url',array('value'=>$post['source_url']));				
				echo $form->input('custom_url',array('value'=>$post['custom_url']));
			?>
		</div>
		<div class="clear"></div>
		<?php echo $form->end(); ?>
	</filedset>
</div>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "simple"
	}); 
</script>